package cj.web.marry.dao;
/*
 *  
 *  
*/
import java.util.List;
import java.util.Map;

import net.paoding.rose.jade.annotation.DAO;
import net.paoding.rose.jade.annotation.SQL;

/**
 * 
 * @author 
 *
 */
@DAO
public interface FollowDAO{
	
	@SQL("SELECT a.*,b.type,b.name,b.nickname,b.sex,b.identityCard,b.photo,b.education,b.profession,b.province,b.city,b.area FROM Follow a join MemberDetail b on a.objectUserId=b.userId WHERE a.userId=:1 ORDER BY a.createAt DESC LIMIT :2,:3 ")
    List<Map> queryByUserId(int userId,int start,int length);
	
	@SQL("SELECT count(1) FROM Follow WHERE userId=:1 ")
    int querySizeByUserId(int userId);
	
    @SQL("SELECT * FROM Follow WHERE userId=:1 ")
    List<Map> queryByUserId(int userId);
    
    @SQL("SELECT count(1) FROM Follow WHERE userId=:1 AND objectUserId=:2 ")
    int querySizeByUserId(int userId,int objectUserId);
    
    @SQL("INSERT INTO Follow (userId,objectUserId,createAt) VALUES (:1,:2,now()) ")
    void create(int userId,int objectUserId);
	
    @SQL("DELETE FROM Follow WHERE userId=:1 AND objectUserId=:2 ")
    void deleteById(int userId,int objectUserId);
}